package p7;

/**
 * @author krystal
 * @date 2022/11/11 20:33
 */
//子类和父类成员变量同名
class A{
    int a = 1;
    int b = 2;
}

class B extends A{
    int a = 10;
    int b = 20;
    int c = 3;
    int d = 4;

    public void test(){
        System.out.println(a);
        System.out.println(b);
        System.out.println(c);
        System.out.println(d);
        //super访问父类成员属性
        System.out.println(super.a);
        System.out.println(super.b);
    }
}

public class Demo4 {
    public static void main(String[] args) {
        B b1=new B();
        b1.test();
    }
}
